package com.scheduled.demo.job;

import com.scheduled.demo.scheduled.RedisScheduled;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

/**
 * @description:
 * @author: chenjianshuo
 * @create: 2019-09-04 16:32
 **/


@Component
public class ScheduledJob {

    private Logger logger = LoggerFactory.getLogger(ScheduledJob.class);


    @Scheduled(cron = "${sched.test.cron}")
    @RedisScheduled(pattern = "ddHHmmss")
    public void testjobA(){
        logger.info("testjob1:{}",System.currentTimeMillis());
    }

    @Scheduled(cron = "${sched.test.cron}")
    @RedisScheduled(lockKey = "testjobA",pattern = "ddHHmmss")
    public void testjobB(){
        logger.info("testjob2:{}",System.currentTimeMillis());
    }
}
